package com.example.demo.controller.admincontroller;

import com.example.demo.common.Result;
import com.example.demo.entity.Admin;
import com.example.demo.service.AdminService;
import com.example.demo.vo.UserLoginVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    private AdminService adminService;

    @PostMapping("/login")
    public Result<UserLoginVo> login(
            @RequestParam("username") String username,
            @RequestParam("password") String password
    ) {
        return Result.success(adminService.login(username, password));
    }

    @GetMapping("/info")
    public Result<Admin> getAdminInfo() {
        return Result.success(adminService.getAdminInfo());
    }
} 